# ● 列表推导式
lst = [ele for ele in range(10)]
lst = [ele for ele in range(10) if ele % 2 == 0]
lst = [ele ** 2 for ele in range(10) if ele % 2 == 0]

# ● 元组推导式
tup = (ele for ele in range(10))
print(list(tup))

# ● 集合推导式
s = {ele for ele in range(10)}

# ● 字典推导式
d = {ele: ele ** 2 for ele in range(5)}

lst1 = [0, 1, 2, 3]
lst2 = ["张三", "李四", "王五"]
# {0: "张三", 1: "李四", 2: "王五"}

print(list(zip(lst1, lst2)))
_dict = {k: v for k, v in zip(lst1, lst2)}
print(_dict)

# lst = [i for i in range(1, 11)]
# rst = [lst[i:i + 3] for i in range(0, len(lst)) if i % 3 == 0]
